//指针封装
function Pointer(option) {
    this._init(option);
}
Pointer.prototype = {
    _init: function (option) {
        this.x = option.x == 0 ? 0 : option.x;
        this.y = option.y == 0 ? 0 : option.y;
        this.strokeWidth = option.strokeWidth || 4;
        this.fillStyle = option.fillStyle || '#000';
        this.strokeStyle = option.strokeStyle || '#000';
        this.angle = option.angle;
        this.length = option.length;
    },
    render: function (ctx) {
        ctx.save();
        ctx.beginPath();
        ctx.translate(this.x, this.y);
        ctx.strokeWidth = this.strokeWidth;
        ctx.fillStyle = this.fillStyle;
        ctx.strokeStyle = this.strokeStyle;
        ctx.moveTo(0, 0);
        ctx.lineTo(this.length * (Math.cos(this.angle * Math.PI / 180)), this.length * (Math.sin(this.angle * Math.PI / 180)));
        ctx.fill();
        ctx.stroke();
        ctx.closePath();
        ctx.restore();
    }

}